package com.zbowen.seata.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zbowen.seata.provider.entity.Account;
import com.zbowen.seata.provider.repository.AccountDao;
import com.zbowen.seata.provider.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DemoServiceImpl implements DemoService {

    @Autowired
    private AccountDao accountDao;

    @Transactional(rollbackFor = Exception.class)
    public void test(String id) {
        LambdaUpdateWrapper<Account> updateWrapper = Wrappers.lambdaUpdate(Account.class);
        updateWrapper.set(Account::getBankCode, "6221690205062262809");
        updateWrapper.set(Account::getBankName, "中国建设银行");
        updateWrapper.eq(Account::getAccount, "55691243");
        accountDao.update(updateWrapper);
    }
}
